<?php
class Pageley_Commerce_Command_ListCategories extends Pageley_Controller_Command_TransactionalRead {

	protected function executeInternal() {
		$unitOfWork = $this->getUnitOfWork();
		$query = new Pageley_Query_Basic(Pageley_Commerce_Domain_Category::type(),
		    new Pageley_Query_Condition_Equals("parentCategory", null));
		$model = new Pageley_Util_ArrayMap();
		$model->put(Pageley_Commerce_Request::CATEGORIES, $unitOfWork->query($query));
		return new Pageley_Controller_ModelAndView($model);
	}
}